package com.ken.springcloud.controller;

import com.ken.springcloud.pojo.Dept;
import com.ken.springcloud.service.FeignDeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

/**
 * <ul>
 * <li>Title: DeptController</li>
 * <li>Description: TODO </li>
 * </ul>
 *
 * @author swc
 * @date 2021-08-26 11:28
 */
@RestController
public class DeptFeignController {

    @Autowired
    private FeignDeptClientService feignDeptClientService;


    @GetMapping("/consumer/add")
    public boolean addDept(Dept dept) {
        return feignDeptClientService.addDept(dept);
    }

    @GetMapping("/consumer/get/{id}")
    public Dept queryById(@PathVariable("id") Long id) {
        return feignDeptClientService.queryById(id);
    }

    @GetMapping("/consumer/list")
    public List<Dept> queryAll() {
        return feignDeptClientService.queryAll();
    }
}
